import cv2
import numpy as np

img = cv2.imread('D:/python/opencv-processing/laiya.jpg')
# print(img.dtype)
# 零时的图层： 1.三层都黑，2.大小与img一样大
b_img = np.zeros(img.shape, dtype=img.dtype)
g_img = np.zeros(img.shape, dtype=img.dtype)
r_img = np.zeros(img.shape, dtype=img.dtype)
# 将图层分离
blue_channel = img[:, :, 0]
green_channel = img[:, :, 1]
red_channel = img[:, :, 2]
# 任何只显示一个通道，就会显示灰白图(300*300*3 -> 300*300)
# 简化处理
# 减低数据量
# 突出应用场景
# hui_channel =

b_img[:, :, 0] = blue_channel
g_img[:, :, 1] = green_channel
r_img[:, :, 2] = red_channel

cv2.imshow('blue',b_img)
cv2.imshow('green',g_img)
cv2.imshow('red',r_img)
cv2.waitKey(0)